package com.hhq.demo.openfeign.controller;

import cn.hutool.json.JSONUtil;
import com.hhq.common.annotation.ApiLog;
import com.hhq.common.domain.vo.CommonResultVO;
import com.hhq.demo.openfeign.domain.req.TestReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>Description: some description </p>
 *
 * @author : xiaodong.yang
 * @date : 2024/1/5 16:48
 */
@RestController
@Slf4j
@Api(tags = "测试接口")
public class TestController {

    @Value("${spring.application.name}")
    private String applicationName;
    /**
     * 测试
     *
     * @param req
     * @return
     */
    @ApiOperation(value = "测试", notes = "测试")
    @PostMapping("/test")
    @ApiLog
    public CommonResultVO<String> test(@RequestBody TestReq req) {
        log.info("请求参数:{}", JSONUtil.toJsonStr(req));
        return CommonResultVO.ok(applicationName);
    }
}
